﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Public;

namespace DAL
{
    public  class QuanHuyenDAL
    {
        public static List<QuanHuyenPublic> LoadQuanHuyen()
        {
            var quanhuyen = Common.db.ExecuteStoreQuery<QuanHuyenPublic>(@"select * from QuanHuyen");
            return quanhuyen.ToList();
        }
        public static List<QuanHuyenPublic> LoadQuanHuyenByMaT(int MaT)
        {
            var qh = Common.db.ExecuteStoreQuery<QuanHuyenPublic>(@"select * from QuanHuyen where MaT=" + MaT);
            return qh.ToList();
        }
        public static int LoadMaQHByMaPX(int MaPX)
        {
            var qh = Common.db.ExecuteStoreQuery<int>("select MaQH from PhuongXa where MaPX=" + MaPX);
            return qh.FirstOrDefault();
        }
    }
}
